// import React from 'react';
import {createAppContainer} from 'react-navigation';
import {createStackNavigator} from 'react-navigation-stack';

import TabBar from './TabBar';
import PageOne from '../screens/PageOne';
import PageTwo from '../screens/PageTwo';
import Login from '../screens/login/Login';

const AppNavigator = createStackNavigator(
  {
    Login: Login,
    TabBar: {
      screen: TabBar,
      navigationOptions: {
        headerShown: false,
      },
    },
    Home: PageOne,
    Details: PageTwo,
  },
  {
    headerLayoutPreset: 'center',
    headerTitleStyle: {
      flex: 1,
      alignItems: 'center',
    },
    /* 定向第一个页面 */
    initialRouteName: 'Login',
    // 所以页面的标题栏均取消
    // headerMode: 'none'
    /* 设置标题栏颜色 */
    defaultNavigationOptions: {
      headerLayoutPreset: 'center',
      headerStyle: {
        backgroundColor: '#f4511e',
      },
      headerTintColor: '#fff',
      headerTitleStyle: {
        fontWeight: 'bold',
      },
    },
  },
);

export default createAppContainer(AppNavigator);
